package com.herench.bs.handler;

import com.herench.bs.agent.IOutpatientClinicAgent;
import com.herench.bs.annotation.Handler;
import com.herench.bs.support.AbstractMessageHandler;
import com.herench.bs.support.RequestMessage;
import com.herench.bs.support.ResponseMessage;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.util.Map;

@Component
@Handler(code = "100501" ,name="专家介绍列表")
public class DoctorInfoListHandler extends AbstractMessageHandler {
    @Override
    protected ResponseMessage innerHandler(RequestMessage requestMessage) throws Exception{
        ResponseMessage responseMessage = new ResponseMessage(requestMessage.getId());
        String deptCode = requestMessage.getArgsPropertyStringValue("deptId");
        Assert.notNull(deptCode, "deptCode 不可为空！");
        String queryType = requestMessage.getArgsPropertyStringValue("queryType");
        IOutpatientClinicAgent outpatientClinicAgent = getCleverClinicContext().getApplicationContext().getBean(IOutpatientClinicAgent.class);
        Map<String,Object> res = outpatientClinicAgent.doctorInfoList(deptCode,queryType);
        responseMessage.setData(res);
        getPropertiesFromInvokerResultMap(responseMessage,res);
        return responseMessage;
    }
}